<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Superpixel Benchmark: lib_refh/lib/graph_segmentation.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Superpixel Benchmark
   </div>
   <div id="projectbrief">Superpixel benchmark, tools and algorithms.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_3e8ad1512b293df663ab69862f493529.html">lib_refh</a></li><li class="navelem"><a class="el" href="dir_caad8d42ef62baddb9a21b9a73b03d2f.html">lib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">graph_segmentation.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="graph__segmentation_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#ifndef GRAPH_SEGMENTATION_H</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#define GRAPH_SEGMENTATION_H</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#include &lt;opencv2/opencv.hpp&gt;</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="image__graph_8h.html">image_graph.h</a>&quot;</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="graph__segmentation_8h.html#aae1349d6c6ad44726e4e0721ae0c3264">   38</a></span>&#160;<span class="preprocessor">#define RAND() ((float) std::rand() / (RAND_MAX))</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="classGraphSegmentationDistance.html">   46</a></span>&#160;<span class="keyword">class </span><a class="code" href="classGraphSegmentationDistance.html">GraphSegmentationDistance</a> {</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="classGraphSegmentationDistance.html#a08d87c2a6ddd52281a135a3102af7491">   50</a></span>&#160;    <a class="code" href="classGraphSegmentationDistance.html#a08d87c2a6ddd52281a135a3102af7491">GraphSegmentationDistance</a>() {};</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    </div><div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="classGraphSegmentationDistance.html#a6634893a2a73f01b8f75f6362bc84065">   54</a></span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classGraphSegmentationDistance.html#a6634893a2a73f01b8f75f6362bc84065">~GraphSegmentationDistance</a>() {};</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    </div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">float</span> <a class="code" href="classGraphSegmentationDistance.html#a8c52505f60a3e1ab795b03be459ea97c">operator()</a>(<span class="keyword">const</span> <a class="code" href="classImageNode.html">ImageNode</a> &amp; n, <span class="keyword">const</span> <a class="code" href="classImageNode.html">ImageNode</a> &amp; m) = 0;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    </div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;};</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div><div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="classGraphSegmentationManhattenRGB.html">   67</a></span>&#160;<span class="keyword">class </span><a class="code" href="classGraphSegmentationManhattenRGB.html">GraphSegmentationManhattenRGB</a> : <span class="keyword">public</span> <a class="code" href="classGraphSegmentationDistance.html">GraphSegmentationDistance</a> {</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="classGraphSegmentationManhattenRGB.html#a4662025dc8ec7f39b7492117f4329172">   71</a></span>&#160;    <a class="code" href="classGraphSegmentationManhattenRGB.html#a4662025dc8ec7f39b7492117f4329172">GraphSegmentationManhattenRGB</a>() {</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;        <span class="comment">// Normalization.</span></div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;        D = 255 + 255 + 255;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    }</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    </div><div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="classGraphSegmentationManhattenRGB.html#abaaffdb864a1c47e96f9210210e76004">   80</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">float</span> <a class="code" href="classGraphSegmentationManhattenRGB.html#abaaffdb864a1c47e96f9210210e76004">operator()</a>(<span class="keyword">const</span> <a class="code" href="classImageNode.html">ImageNode</a> &amp; n, <span class="keyword">const</span> <a class="code" href="classImageNode.html">ImageNode</a> &amp; m) {</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        <span class="keywordtype">float</span> dr = std::abs(n.<a class="code" href="classImageNode.html#a86f3aac88fc636b0df9dacfaebb5aacf">r</a> - m.<a class="code" href="classImageNode.html#a86f3aac88fc636b0df9dacfaebb5aacf">r</a>);</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        <span class="keywordtype">float</span> dg = std::abs(n.<a class="code" href="classImageNode.html#a3afa3dc020507c774d4fa6e0923125b9">g</a> - m.<a class="code" href="classImageNode.html#a3afa3dc020507c774d4fa6e0923125b9">g</a>);</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        <span class="keywordtype">float</span> db = std::abs(n.<a class="code" href="classImageNode.html#ac87d02969990f343f115eb651c9c27a6">b</a> - m.<a class="code" href="classImageNode.html#ac87d02969990f343f115eb651c9c27a6">b</a>);</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;        </div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;        <span class="keywordflow">return</span> (dr + dg + db);</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    }</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    </div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    </div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="keywordtype">float</span> D;</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    </div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;};</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="classGraphSegmentationEuclideanRGB.html">   98</a></span>&#160;<span class="keyword">class </span><a class="code" href="classGraphSegmentationEuclideanRGB.html">GraphSegmentationEuclideanRGB</a> : <span class="keyword">public</span> <a class="code" href="classGraphSegmentationDistance.html">GraphSegmentationDistance</a> {</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="classGraphSegmentationEuclideanRGB.html#ab2d3763f00a04df7b03eb647d9eeca02">  102</a></span>&#160;    <a class="code" href="classGraphSegmentationEuclideanRGB.html#ab2d3763f00a04df7b03eb647d9eeca02">GraphSegmentationEuclideanRGB</a>() {</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        <span class="comment">// Normalization.</span></div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        D = std::sqrt(255*255 + 255*255 + 255*255);</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    }</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    </div><div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="classGraphSegmentationEuclideanRGB.html#ad43ad4e5f970dc8da316a4184b0baac1">  111</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">float</span> <a class="code" href="classGraphSegmentationEuclideanRGB.html#ad43ad4e5f970dc8da316a4184b0baac1">operator()</a>(<span class="keyword">const</span> <a class="code" href="classImageNode.html">ImageNode</a> &amp; n, <span class="keyword">const</span> <a class="code" href="classImageNode.html">ImageNode</a> &amp; m) {</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;        <span class="keywordtype">float</span> dr = n.<a class="code" href="classImageNode.html#a86f3aac88fc636b0df9dacfaebb5aacf">r</a> - m.<a class="code" href="classImageNode.html#a86f3aac88fc636b0df9dacfaebb5aacf">r</a>;</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;        <span class="keywordtype">float</span> dg = n.<a class="code" href="classImageNode.html#a3afa3dc020507c774d4fa6e0923125b9">g</a> - m.<a class="code" href="classImageNode.html#a3afa3dc020507c774d4fa6e0923125b9">g</a>;</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;        <span class="keywordtype">float</span> db = n.<a class="code" href="classImageNode.html#ac87d02969990f343f115eb651c9c27a6">b</a> - m.<a class="code" href="classImageNode.html#ac87d02969990f343f115eb651c9c27a6">b</a>;</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        </div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        <span class="keywordflow">return</span> std::sqrt(dr*dr + dg*dg + db*db);</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    }</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    </div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    </div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <span class="keywordtype">float</span> D;</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    </div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;};</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;</div><div class="line"><a name="l00131"></a><span class="lineno"><a class="line" href="classGraphSegmentationMagic.html">  131</a></span>&#160;<span class="keyword">class </span><a class="code" href="classGraphSegmentationMagic.html">GraphSegmentationMagic</a> {</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="classGraphSegmentationMagic.html#adb1d296f73935b0b0f089e617e3a7e97">  135</a></span>&#160;    <a class="code" href="classGraphSegmentationMagic.html#adb1d296f73935b0b0f089e617e3a7e97">GraphSegmentationMagic</a>() {};</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;    </div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classGraphSegmentationDistance.html#a8c52505f60a3e1ab795b03be459ea97c">operator()</a>(<span class="keyword">const</span> <a class="code" href="classImageNode.html">ImageNode</a> &amp; S_n, <span class="keyword">const</span> <a class="code" href="classImageNode.html">ImageNode</a> &amp; S_m, </div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;            <span class="keyword">const</span> <a class="code" href="classImageEdge.html">ImageEdge</a> &amp; e) = 0;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    </div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;};</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div><div class="line"><a name="l00152"></a><span class="lineno"><a class="line" href="classGraphSegmentationMagicThreshold.html">  152</a></span>&#160;<span class="keyword">class </span><a class="code" href="classGraphSegmentationMagicThreshold.html">GraphSegmentationMagicThreshold</a> : <span class="keyword">public</span> <a class="code" href="classGraphSegmentationMagic.html">GraphSegmentationMagic</a> {</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00157"></a><span class="lineno"><a class="line" href="classGraphSegmentationMagicThreshold.html#a2636ec68067e125b81b986593037c518">  157</a></span>&#160;    <a class="code" href="classGraphSegmentationMagicThreshold.html#a2636ec68067e125b81b986593037c518">GraphSegmentationMagicThreshold</a>(<span class="keywordtype">float</span> c) : c(c) {};</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;    </div><div class="line"><a name="l00166"></a><span class="lineno"><a class="line" href="classGraphSegmentationMagicThreshold.html#a9572546f7b6961c62f4d6e7f5983bd0c">  166</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classGraphSegmentationMagicThreshold.html#a9572546f7b6961c62f4d6e7f5983bd0c">operator()</a>(<span class="keyword">const</span> <a class="code" href="classImageNode.html">ImageNode</a> &amp; S_n, <span class="keyword">const</span> <a class="code" href="classImageNode.html">ImageNode</a> &amp; S_m, </div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;            <span class="keyword">const</span> <a class="code" href="classImageEdge.html">ImageEdge</a> &amp; e) {</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        </div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;        <span class="keywordtype">float</span> threshold = std::min(S_n.<a class="code" href="classImageNode.html#a0b28fde40ffadf4dfe8abdbd14585f8f">max_w</a> + c/S_n.<a class="code" href="classImageNode.html#a7de8ae92a9850e192963bb92843bfdfd">n</a>, S_m.<a class="code" href="classImageNode.html#a0b28fde40ffadf4dfe8abdbd14585f8f">max_w</a> + c/S_m.<a class="code" href="classImageNode.html#a7de8ae92a9850e192963bb92843bfdfd">n</a>);</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;        </div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;        <span class="keywordflow">if</span> (e.<a class="code" href="classImageEdge.html#a75943016bab344c88e717f479eea8843">w</a> &lt; threshold) {</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;        }</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;        </div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;    }</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;    </div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    </div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="keywordtype">float</span> c;</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    </div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;};</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;</div><div class="line"><a name="l00189"></a><span class="lineno"><a class="line" href="classGraphSegmentation.html">  189</a></span>&#160;<span class="keyword">class </span><a class="code" href="classGraphSegmentation.html">GraphSegmentation</a> {</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00193"></a><span class="lineno"><a class="line" href="classGraphSegmentation.html#a0a7c979a756578260b7f7a77daedbfd6">  193</a></span>&#160;    <a class="code" href="classGraphSegmentation.html#a0a7c979a756578260b7f7a77daedbfd6">GraphSegmentation</a>() : distance(new <a class="code" href="classGraphSegmentationManhattenRGB.html">GraphSegmentationManhattenRGB</a>()), </div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;            magic(new <a class="code" href="classGraphSegmentationMagicThreshold.html">GraphSegmentationMagicThreshold</a>(1)) {</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;        </div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;    };</div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    </div><div class="line"><a name="l00200"></a><span class="lineno"><a class="line" href="classGraphSegmentation.html#a9f248edb298452087cb3f744e3446e7b">  200</a></span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classGraphSegmentation.html#a9f248edb298452087cb3f744e3446e7b">~GraphSegmentation</a>() {};</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;    </div><div class="line"><a name="l00205"></a><span class="lineno"><a class="line" href="classGraphSegmentation.html#a8288ad1d61ba652c638db6fc7f386178">  205</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classGraphSegmentation.html#a8288ad1d61ba652c638db6fc7f386178">setDistance</a>(<a class="code" href="classGraphSegmentationDistance.html">GraphSegmentationDistance</a>* _distance) {</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        distance = _distance;</div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    }</div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;    </div><div class="line"><a name="l00212"></a><span class="lineno"><a class="line" href="classGraphSegmentation.html#aaa35c66daca56fd9a2c3a8eff6858bb5">  212</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classGraphSegmentation.html#aaa35c66daca56fd9a2c3a8eff6858bb5">setMagic</a>(<a class="code" href="classGraphSegmentationMagic.html">GraphSegmentationMagic</a>* _magic) {</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;        magic = _magic;</div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;    }</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;    </div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;    <span class="keywordtype">void</span> buildGraph(<span class="keyword">const</span> cv::Mat &amp;image);</div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;    </div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;    <span class="keywordtype">void</span> oversegmentGraph();</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;    </div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    <span class="keywordtype">void</span> enforceMinimumSegmentSize(<span class="keywordtype">int</span> M);</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;    </div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;    cv::Mat deriveLabels();</div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;    </div><div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;<span class="keyword">protected</span>:</div><div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;    </div><div class="line"><a name="l00239"></a><span class="lineno"><a class="line" href="classGraphSegmentation.html#a7e7e4629c429d02aa3ace60ffe7f1fac">  239</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classGraphSegmentation.html#a7e7e4629c429d02aa3ace60ffe7f1fac">H</a>;</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    </div><div class="line"><a name="l00242"></a><span class="lineno"><a class="line" href="classGraphSegmentation.html#ac95cd8ea068ae68c527c69bc0ee5fe20">  242</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classGraphSegmentation.html#ac95cd8ea068ae68c527c69bc0ee5fe20">W</a>;</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    </div><div class="line"><a name="l00245"></a><span class="lineno"><a class="line" href="classGraphSegmentation.html#a85210dcca3204ab0103cdb118653c211">  245</a></span>&#160;    <a class="code" href="classImageGraph.html">ImageGraph</a> <a class="code" href="classGraphSegmentation.html#a85210dcca3204ab0103cdb118653c211">graph</a>;</div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;    </div><div class="line"><a name="l00248"></a><span class="lineno"><a class="line" href="classGraphSegmentation.html#a36fda8d29ad5c2375a15ed7313393f21">  248</a></span>&#160;    <a class="code" href="classGraphSegmentationDistance.html">GraphSegmentationDistance</a>* <a class="code" href="classGraphSegmentation.html#a36fda8d29ad5c2375a15ed7313393f21">distance</a>;</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;    </div><div class="line"><a name="l00251"></a><span class="lineno"><a class="line" href="classGraphSegmentation.html#a743d4068f05c9de389baaa9b90c58b00">  251</a></span>&#160;    <a class="code" href="classGraphSegmentationMagic.html">GraphSegmentationMagic</a>* <a class="code" href="classGraphSegmentation.html#a743d4068f05c9de389baaa9b90c58b00">magic</a>;</div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;</div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;};</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;<span class="preprocessor">#endif  </span><span class="comment">/* GRAPH_SEGMENTATION_H */</span><span class="preprocessor"></span></div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;</div><div class="ttc" id="classImageNode_html_a7de8ae92a9850e192963bb92843bfdfd"><div class="ttname"><a href="classImageNode.html#a7de8ae92a9850e192963bb92843bfdfd">ImageNode::n</a></div><div class="ttdeci">unsigned long int n</div><div class="ttdoc">Size of node after merging with other nodes. </div><div class="ttdef"><b>Definition:</b> image_graph.h:101</div></div>
<div class="ttc" id="classGraphSegmentationDistance_html_a8c52505f60a3e1ab795b03be459ea97c"><div class="ttname"><a href="classGraphSegmentationDistance.html#a8c52505f60a3e1ab795b03be459ea97c">GraphSegmentationDistance::operator()</a></div><div class="ttdeci">virtual float operator()(const ImageNode &amp;n, const ImageNode &amp;m)=0</div><div class="ttdoc">Compute the distance given 2 nodes. </div></div>
<div class="ttc" id="classGraphSegmentationEuclideanRGB_html_ab2d3763f00a04df7b03eb647d9eeca02"><div class="ttname"><a href="classGraphSegmentationEuclideanRGB.html#ab2d3763f00a04df7b03eb647d9eeca02">GraphSegmentationEuclideanRGB::GraphSegmentationEuclideanRGB</a></div><div class="ttdeci">GraphSegmentationEuclideanRGB()</div><div class="ttdoc">Constructor; sets normalization constant. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:102</div></div>
<div class="ttc" id="classImageNode_html_a0b28fde40ffadf4dfe8abdbd14585f8f"><div class="ttname"><a href="classImageNode.html#a0b28fde40ffadf4dfe8abdbd14585f8f">ImageNode::max_w</a></div><div class="ttdeci">float max_w</div><div class="ttdoc">Maximum weight. </div><div class="ttdef"><b>Definition:</b> image_graph.h:107</div></div>
<div class="ttc" id="classImageNode_html"><div class="ttname"><a href="classImageNode.html">ImageNode</a></div><div class="ttdoc">Represents a pixel in a video. Each pixel is represented by its color which is needed to compute the ...</div><div class="ttdef"><b>Definition:</b> image_graph.h:80</div></div>
<div class="ttc" id="classGraphSegmentationMagic_html"><div class="ttname"><a href="classGraphSegmentationMagic.html">GraphSegmentationMagic</a></div><div class="ttdoc">The magic part of the graph segmentation, i.e. s given two nodes decide whether to add an edge betwee...</div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:131</div></div>
<div class="ttc" id="classGraphSegmentation_html_aaa35c66daca56fd9a2c3a8eff6858bb5"><div class="ttname"><a href="classGraphSegmentation.html#aaa35c66daca56fd9a2c3a8eff6858bb5">GraphSegmentation::setMagic</a></div><div class="ttdeci">void setMagic(GraphSegmentationMagic *_magic)</div><div class="ttdoc">Set the magic part of graph segmentation. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:212</div></div>
<div class="ttc" id="classImageNode_html_ac87d02969990f343f115eb651c9c27a6"><div class="ttname"><a href="classImageNode.html#ac87d02969990f343f115eb651c9c27a6">ImageNode::b</a></div><div class="ttdeci">unsigned char b</div><div class="ttdoc">Blue channel. </div><div class="ttdef"><b>Definition:</b> image_graph.h:86</div></div>
<div class="ttc" id="classGraphSegmentation_html_a8288ad1d61ba652c638db6fc7f386178"><div class="ttname"><a href="classGraphSegmentation.html#a8288ad1d61ba652c638db6fc7f386178">GraphSegmentation::setDistance</a></div><div class="ttdeci">void setDistance(GraphSegmentationDistance *_distance)</div><div class="ttdoc">Set the distance to use. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:205</div></div>
<div class="ttc" id="classGraphSegmentation_html_a743d4068f05c9de389baaa9b90c58b00"><div class="ttname"><a href="classGraphSegmentation.html#a743d4068f05c9de389baaa9b90c58b00">GraphSegmentation::magic</a></div><div class="ttdeci">GraphSegmentationMagic * magic</div><div class="ttdoc">The magic part of graph segmentation. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:251</div></div>
<div class="ttc" id="classGraphSegmentationManhattenRGB_html"><div class="ttname"><a href="classGraphSegmentationManhattenRGB.html">GraphSegmentationManhattenRGB</a></div><div class="ttdoc">Manhatten (i.e. L1) distance. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:67</div></div>
<div class="ttc" id="classGraphSegmentationMagic_html_adb1d296f73935b0b0f089e617e3a7e97"><div class="ttname"><a href="classGraphSegmentationMagic.html#adb1d296f73935b0b0f089e617e3a7e97">GraphSegmentationMagic::GraphSegmentationMagic</a></div><div class="ttdeci">GraphSegmentationMagic()</div><div class="ttdoc">Constructor. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:135</div></div>
<div class="ttc" id="classGraphSegmentationEuclideanRGB_html"><div class="ttname"><a href="classGraphSegmentationEuclideanRGB.html">GraphSegmentationEuclideanRGB</a></div><div class="ttdoc">Euclidean RGB distance. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:98</div></div>
<div class="ttc" id="classGraphSegmentationManhattenRGB_html_abaaffdb864a1c47e96f9210210e76004"><div class="ttname"><a href="classGraphSegmentationManhattenRGB.html#abaaffdb864a1c47e96f9210210e76004">GraphSegmentationManhattenRGB::operator()</a></div><div class="ttdeci">virtual float operator()(const ImageNode &amp;n, const ImageNode &amp;m)</div><div class="ttdoc">Compute the distance given 2 nodes. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:80</div></div>
<div class="ttc" id="classGraphSegmentation_html_a85210dcca3204ab0103cdb118653c211"><div class="ttname"><a href="classGraphSegmentation.html#a85210dcca3204ab0103cdb118653c211">GraphSegmentation::graph</a></div><div class="ttdeci">ImageGraph graph</div><div class="ttdoc">The constructed and segmented image graph. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:245</div></div>
<div class="ttc" id="classImageNode_html_a86f3aac88fc636b0df9dacfaebb5aacf"><div class="ttname"><a href="classImageNode.html#a86f3aac88fc636b0df9dacfaebb5aacf">ImageNode::r</a></div><div class="ttdeci">unsigned char r</div><div class="ttdoc">Red channel. </div><div class="ttdef"><b>Definition:</b> image_graph.h:95</div></div>
<div class="ttc" id="classGraphSegmentation_html_a7e7e4629c429d02aa3ace60ffe7f1fac"><div class="ttname"><a href="classGraphSegmentation.html#a7e7e4629c429d02aa3ace60ffe7f1fac">GraphSegmentation::H</a></div><div class="ttdeci">int H</div><div class="ttdoc">Image height. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:239</div></div>
<div class="ttc" id="classGraphSegmentationEuclideanRGB_html_ad43ad4e5f970dc8da316a4184b0baac1"><div class="ttname"><a href="classGraphSegmentationEuclideanRGB.html#ad43ad4e5f970dc8da316a4184b0baac1">GraphSegmentationEuclideanRGB::operator()</a></div><div class="ttdeci">virtual float operator()(const ImageNode &amp;n, const ImageNode &amp;m)</div><div class="ttdoc">Compute the distance given 2 nodes. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:111</div></div>
<div class="ttc" id="classImageNode_html_a3afa3dc020507c774d4fa6e0923125b9"><div class="ttname"><a href="classImageNode.html#a3afa3dc020507c774d4fa6e0923125b9">ImageNode::g</a></div><div class="ttdeci">unsigned char g</div><div class="ttdoc">Green channel. </div><div class="ttdef"><b>Definition:</b> image_graph.h:92</div></div>
<div class="ttc" id="classGraphSegmentationManhattenRGB_html_a4662025dc8ec7f39b7492117f4329172"><div class="ttname"><a href="classGraphSegmentationManhattenRGB.html#a4662025dc8ec7f39b7492117f4329172">GraphSegmentationManhattenRGB::GraphSegmentationManhattenRGB</a></div><div class="ttdeci">GraphSegmentationManhattenRGB()</div><div class="ttdoc">Constructor; sets normalization constant. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:71</div></div>
<div class="ttc" id="classGraphSegmentation_html"><div class="ttname"><a href="classGraphSegmentation.html">GraphSegmentation</a></div><div class="ttdoc">Implementation of graph based image segmentation as described in the paper by Felzenswalb and Huttenl...</div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:189</div></div>
<div class="ttc" id="classGraphSegmentationMagicThreshold_html_a9572546f7b6961c62f4d6e7f5983bd0c"><div class="ttname"><a href="classGraphSegmentationMagicThreshold.html#a9572546f7b6961c62f4d6e7f5983bd0c">GraphSegmentationMagicThreshold::operator()</a></div><div class="ttdeci">virtual bool operator()(const ImageNode &amp;S_n, const ImageNode &amp;S_m, const ImageEdge &amp;e)</div><div class="ttdoc">Decide whether to merge the two segments corresponding to the given nodes or not. ...</div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:166</div></div>
<div class="ttc" id="classGraphSegmentationDistance_html_a08d87c2a6ddd52281a135a3102af7491"><div class="ttname"><a href="classGraphSegmentationDistance.html#a08d87c2a6ddd52281a135a3102af7491">GraphSegmentationDistance::GraphSegmentationDistance</a></div><div class="ttdeci">GraphSegmentationDistance()</div><div class="ttdoc">Constructor. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:50</div></div>
<div class="ttc" id="classImageGraph_html"><div class="ttname"><a href="classImageGraph.html">ImageGraph</a></div><div class="ttdoc">Represents an image graph, consisting of one node per pixel which are 4-connected. </div><div class="ttdef"><b>Definition:</b> image_graph.h:115</div></div>
<div class="ttc" id="classGraphSegmentationDistance_html"><div class="ttname"><a href="classGraphSegmentationDistance.html">GraphSegmentationDistance</a></div><div class="ttdoc">Interface to be implemented by a concerete distance. The distance defines how the weights between nod...</div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:46</div></div>
<div class="ttc" id="classGraphSegmentation_html_a0a7c979a756578260b7f7a77daedbfd6"><div class="ttname"><a href="classGraphSegmentation.html#a0a7c979a756578260b7f7a77daedbfd6">GraphSegmentation::GraphSegmentation</a></div><div class="ttdeci">GraphSegmentation()</div><div class="ttdoc">Default constructor; uses the Manhatten distance. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:193</div></div>
<div class="ttc" id="classGraphSegmentationDistance_html_a6634893a2a73f01b8f75f6362bc84065"><div class="ttname"><a href="classGraphSegmentationDistance.html#a6634893a2a73f01b8f75f6362bc84065">GraphSegmentationDistance::~GraphSegmentationDistance</a></div><div class="ttdeci">virtual ~GraphSegmentationDistance()</div><div class="ttdoc">Destructor. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:54</div></div>
<div class="ttc" id="classImageEdge_html_a75943016bab344c88e717f479eea8843"><div class="ttname"><a href="classImageEdge.html#a75943016bab344c88e717f479eea8843">ImageEdge::w</a></div><div class="ttdeci">float w</div><div class="ttdoc">Edge weight. </div><div class="ttdef"><b>Definition:</b> image_graph.h:57</div></div>
<div class="ttc" id="classGraphSegmentationMagicThreshold_html"><div class="ttname"><a href="classGraphSegmentationMagicThreshold.html">GraphSegmentationMagicThreshold</a></div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:152</div></div>
<div class="ttc" id="classGraphSegmentation_html_ac95cd8ea068ae68c527c69bc0ee5fe20"><div class="ttname"><a href="classGraphSegmentation.html#ac95cd8ea068ae68c527c69bc0ee5fe20">GraphSegmentation::W</a></div><div class="ttdeci">int W</div><div class="ttdoc">Image widt.h. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:242</div></div>
<div class="ttc" id="classImageEdge_html"><div class="ttname"><a href="classImageEdge.html">ImageEdge</a></div><div class="ttdoc">Represents an edge between two pixels in an image. Each edge is characterized by a weight and the adj...</div><div class="ttdef"><b>Definition:</b> image_graph.h:44</div></div>
<div class="ttc" id="image__graph_8h_html"><div class="ttname"><a href="image__graph_8h.html">image_graph.h</a></div></div>
<div class="ttc" id="classGraphSegmentation_html_a9f248edb298452087cb3f744e3446e7b"><div class="ttname"><a href="classGraphSegmentation.html#a9f248edb298452087cb3f744e3446e7b">GraphSegmentation::~GraphSegmentation</a></div><div class="ttdeci">virtual ~GraphSegmentation()</div><div class="ttdoc">Destructor. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:200</div></div>
<div class="ttc" id="classGraphSegmentation_html_a36fda8d29ad5c2375a15ed7313393f21"><div class="ttname"><a href="classGraphSegmentation.html#a36fda8d29ad5c2375a15ed7313393f21">GraphSegmentation::distance</a></div><div class="ttdeci">GraphSegmentationDistance * distance</div><div class="ttdoc">The underlying distance to use. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:248</div></div>
<div class="ttc" id="classGraphSegmentationMagicThreshold_html_a2636ec68067e125b81b986593037c518"><div class="ttname"><a href="classGraphSegmentationMagicThreshold.html#a2636ec68067e125b81b986593037c518">GraphSegmentationMagicThreshold::GraphSegmentationMagicThreshold</a></div><div class="ttdeci">GraphSegmentationMagicThreshold(float c)</div><div class="ttdoc">Constructor; sets the threshold. </div><div class="ttdef"><b>Definition:</b> graph_segmentation.h:157</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Apr 16 2017 16:39:17 for Superpixel Benchmark by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
